package Game;

import java.awt.Graphics2D;
import java.awt.Rectangle;

public abstract class AnimatedObject extends GameObject
{
	int x, y, w, h;
	
	Animation animation;
	
	boolean animationActive;
	boolean visible;
	
	public AnimatedObject(int x, int y, int w, int h)
	{
		super(x, y, w, h);
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		animationActive = false;
		visible = true;
	}
	
	public Rectangle getRectangle()
	{
		
		return new Rectangle(x, y, w, h);
	}
	
	public void Update()
	{
		animation.Update(x, y, animationActive);
	}
	
	public void Draw(Graphics2D g2d)
	{
		super.Draw(g2d);
		
		if(animation != null)
		{
			if(visible)
			{
				animation.Draw(g2d);
			}
		}
	}
}
